package dujiu.luogu.circulation;

import java.math.BigInteger;
import java.util.Scanner;

public class P1009 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        BigInteger num = new BigInteger("0");
        BigInteger sum = new BigInteger("1");
        for (int i = 1; i <= n; i++) {
            sum = sum.multiply(new BigInteger(i + ""));
            num = num.add(sum);
        }
        System.out.println(num);
    }
}
